var secondHand = document.querySelector('.second-hand')
var minuteHand = document.querySelector('.minute-hand')
var hourHand = document.querySelector('.hour-hand')
function setDate() {
    //拿到当前时间
    var now = new Date()

    //读秒
    var seconds = now.getSeconds()

    //计算旋转角度
    var secondsDeg = ((seconds / 60) * 360) + 90

    //设置秒针角度
    secondHand.style.transform = `rotate(${secondsDeg}deg)`

    //读分
    var minutes = now.getMinutes()

    //计算旋转角度
    var minutesDeg = ((minutes / 60)* 360) + 90

    //设置分针角度
    minuteHand.style.transform = `rotate(${minutesDeg}deg)`

    //读时
    var hours = now.getHours()

    //计算旋转角度
    var hoursDeg = ((hours / 12) * 360 +  (minutes / 60)*30) + 90

    //设置时针角度
    hourHand.style.transform = `rotate(${hoursDeg}deg)`

}


setInterval(setDate, 1000);